home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / MatrixEnumeration.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-12-16  |  2.0 KB  |  101 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.util.Enumeration;
  4.  
  5. class MatrixEnumeration implements Enumeration {
  6.    // $FF: renamed from: m symantec.itools.awt.Matrix
  7.    Matrix field_0;
  8.    boolean started;
  9.  
  10.    MatrixEnumeration(Matrix var1) {
  11.       this.field_0 = var1;
  12.    }
  13.  
  14.    public boolean hasMoreElements() {
  15.       return this.field_0.nextElt != null ? true : this.hasMoreRows();
  16.    }
  17.  
  18.    public boolean hasMoreRows() {
  19.       if (this.field_0.nextRow == null) {
  20.          return false;
  21.       } else {
  22.          Matrix var1 = this.field_0.nextRow;
  23.  
  24.          while(var1.o == null && var1.nextElt == null) {
  25.             if ((var1 = var1.nextRow) == null) {
  26.                return false;
  27.             }
  28.          }
  29.  
  30.          return true;
  31.       }
  32.    }
  33.  
  34.    public Object nextElement() {
  35.       if (!this.started) {
  36.          this.started = true;
  37.          if (this.field_0.o != null) {
  38.             return this.field_0.o;
  39.          }
  40.       }
  41.  
  42.       if (this.field_0 == null) {
  43.          return null;
  44.       } else if (this.field_0.nextElt != null) {
  45.          this.field_0 = this.field_0.nextElt;
  46.          return this.field_0.o;
  47.       } else {
  48.          return (this.field_0 = this.findNextRow()) == null ? null : this.field_0.o;
  49.       }
  50.    }
  51.  
  52.    Matrix findNextRow() {
  53.       this.started = true;
  54.       Matrix var1 = this.field_0.nextRow;
  55.       if (var1 == null) {
  56.          return null;
  57.       } else {
  58.          while(var1.o == null && var1.nextElt == null) {
  59.             if ((var1 = var1.nextRow) == null) {
  60.                return null;
  61.             }
  62.          }
  63.  
  64.          var1 = var1.o != null ? var1 : var1.nextElt;
  65.          return var1;
  66.       }
  67.    }
  68.  
  69.    public int currRow() {
  70.       return this.field_0.row;
  71.    }
  72.  
  73.    public int currCol() {
  74.       return this.field_0.col;
  75.    }
  76.  
  77.    public Object nextRow() {
  78.       this.field_0 = this.findNextRow();
  79.       return this.field_0.o;
  80.    }
  81.  
  82.    public Object advanceTo(int var1) throws IllegalArgumentException {
  83.       this.started = true;
  84.       if (var1 >= this.field_0.row && var1 != this.field_0.row) {
  85.          Matrix var2 = this.field_0;
  86.  
  87.          while(this.field_0.row < var1) {
  88.             this.field_0 = this.findNextRow();
  89.             if (this.field_0 == null) {
  90.                this.field_0 = var2;
  91.                throw new IllegalArgumentException("requested row too large: r=" + var1);
  92.             }
  93.          }
  94.  
  95.          return this.field_0.o;
  96.       } else {
  97.          throw new IllegalArgumentException("r must be greater than current row: r=" + var1 + "current row=" + this.field_0.row);
  98.       }
  99.    }
  100. }
  101.